<@>layout("/common/default.html"){
<div style="padding: 3px" >
    <form class="layui-form" id="newrole-date">
        <div class="layui-form-item">
            <button type="button" class="layui-btn layui-btn-sm  layui-btn-normal"  id="uploadImg" ><i class="layui-icon">&#xe67c;</i>上传图片</button>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <input type="hidden" value="${fileOnline.id}" name="id">
        <button type="button" onclick="saverole();" class="layui-btn" style="position: relative;left: 30px">提交</button>
    </form>
</div>
<script>
    $(function () {
        var Imgentity = {};// 传输数据的实体变量
        Imgentity.number = gropWtdbh;
        layui.use('upload', function(){
            var upload = layui.upload;
            var imgUrl = "${ctxPath}/ajax/layim/uploadImg";
            //执行实例
            var uploadInst = upload.render({
                elem: '#uploadImg' //绑定元素
                ,url: imgUrl //上传接口
                ,method: 'POST'
                ,accept : 'images'
                ,data : Imgentity
                ,async:false
                ,done: function(r){
                    //上传完毕回调
                    var code = r.code;
                    var imgUrl = r.imgUrl;
                    var msg = r.msg;
                    //假设code=0代表上传成功
                    if(code == '1'){
                        sendUploadImg(imgUrl);
                    }else {
                        $.msg(msg, function () {
                        }, 2);
                    }
                }
                ,error: function(){
                }
            });
        });
    })
/*    function saverole() {
        $.cajax('${ctxPath}/ajax/role/saverole', $('#newrole-date').serialize(), function (r) {
            var code = r.code;
            var msg = r.msg;
            if (code == '1') {
                $.msg(msg, function () {
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    console.log(index);
                    parent.layer.close(index); //再执行关闭z
                    parent.doSearch();
                }, code);
            } else {
                $.msg(msg, function () {
                }, 2);
            }
        });
    }*/
</script>
<@>}